
function GM:PlayerSelectSpawn(pl)

	if self.SpawnPoints == nil then
	
		self.SpawnPoints = ents.FindByClass( "info_player_terrorist" )
		self.SpawnPoints = table.Add(self.SpawnPoints, ents.FindByClass( "info_player_counterterrorist" ))
		self.SpawnPoints = table.Add(self.SpawnPoints, ents.FindByClass( "info_player_combine" ))
		self.SpawnPoints = table.Add(self.SpawnPoints, ents.FindByClass( "info_player_rebel" ))
		self.SpawnPoints = table.Add(self.SpawnPoints, ents.FindByClass( "info_player_deathmatch" ))
		self.SpawnPoints = table.Add(self.SpawnPoints, ents.FindByClass( "info_player_start" ))
		
	end
	
	local Count = #self.SpawnPoints
	if Count == 0 then return pl end
	for i=0, 20 do
		local ChosenSpawnPoint = self.SpawnPoints[math.random(1, Count)]
		if ChosenSpawnPoint and ChosenSpawnPoint:IsValid() and ChosenSpawnPoint:IsInWorld() then
			local blocked = false
			for _, ent in pairs(ents.FindInBox(ChosenSpawnPoint:GetPos() + Vector(-48, -48, 0), ChosenSpawnPoint:GetPos() + Vector(48, 48, 60))) do
				if ent and ent:IsPlayer() then
					blocked = true
				end
			end
			if not blocked then
				LastUsedSpawnPoint = ChosenSpawnPoint
				return ChosenSpawnPoint
			end
		end
	end
	return LastUsedSpawnPoint
end

//local gRaycastEntity = nil;

function PlayerThink(player)

player:DrawViewModel(drawPlayerWeapon)
//
//	//Highlighting logic
//	local rayTrace = player:GetEyeTrace() 
//
//	if(rayTrace.Entity and rayTrace.Entity:IsValid()) then
//
//		if gRaycastEntity != rayTrace.Entity then
//
//			if gRaycastEntity and gRaycastEntity:IsValid() then
//				gRaycastEntity:SetMaterial("")
//			end
//
//			gRaycastEntity = rayTrace.Entity
//if CLIENT then
//			render.SetMaterial(Material("sprites/physg_glow1"))
//			render.DrawSprite(gRaycastEntity:GetPos(),64,64,Color(255,255,255,255))
//end
//			//gRaycastEntity:SetMaterial("Models/effects/splodearc_sheet") 
//	   end
//
//	elseif gRaycastEntity and gRaycastEntity:IsValid() then
//
////		gRaycastEntity:SetMaterial("")
//		gRaycastEntity = nil
//
//	end
//
//	//Pickup/Putdown logic
//	/*local carryEntity = player:GetNWEntity("CarryEntity")
//	if( carryEntity and carryEntity:IsValid()) then
//
//		carryEntity:SetMaterial("Models/effects/splodearc_sheet") 
//		
//		local entityPosition = player:EyePos() + (player:GetAimVector() * player:GetNWFloat("CarryDistance"))
//		carryEntity:SetPos(entityPosition)
//
//	end*/
end

function PlayerClickEntityLogic(player, direction, trace)

end

function PlayerPickupLogic(player, entity)

	/*local carryEntity = player:GetNWEntity("CarryEntity")
	if( carryEntity and carryEntity:IsValid()) then
		
		local physicsObject = carryEntity:GetPhysicsObject()
		if physicsObject:IsValid() then
			physicsObject:Wake()
		end
		
		carryEntity:SetMaterial("") 
		player:SetNWEntity("CarryEntity", NULL)
		player:SetNWFloat("CarryDistance", 0.0)
		return true
	end
	
	if entity and entity:IsValid() then
		player:SetNWEntity("CarryEntity", entity)
		player:SetNWFloat("CarryDistance", player:GetPos():Distance(entity:GetPos()))
		return true
	else
		return false
	
	end
	print("exit")*/
end


